<!--
 * @Date: 2022-07-12 23:34:54
 * @LastEditTime: 2022-07-14 09:56:58
-->
<template>
  <el-card class="chat-main">
    <div slot="header">最近私信</div>
    <div class="chat-body">
      <div class="chat-list">
        <UserContainer :userInfo="userTest" />
      </div>
      <div class="chat-panel">
        <div class="chat-display">panel</div>
        <el-input class="chat-input" type="textarea" v-model="input" max="50"></el-input>
        <div class="chat-bottom">
          <el-button type="primary">发送</el-button>
        </div>
      </div>
    </div>
  </el-card>
</template>

<script>
import { send } from '@/api/chat.js'
import UserContainer from './UserContainer.vue'
export default {
  name: 'ChatMain',
  components: {
    UserContainer
  },
  data () {
    return {
      targetId: this.$route.params.id,
      userTest: {
        nickname: 'test',
        pic: this.picbed + '/avator/head0.jpg',
        latest_message: 'hello！1111111111111111111111111111111'
      },
      input: ''
    }
  },
  methods: {
    send () {
      send(this.input, this.targetId)
        .then(res => {
          if (res.data.state === 200) {
          }
        })
    }

  }
}
</script>

<style>
.chat-main {
  margin: 40px 0 40px 0;
  display: flex;
  flex-direction: column;
  height: 500px;
  width: 100%;
}
.chat-main > .el-card__header {
  padding: 0;
  height: 50px;
  line-height: 50px;
  padding-left: 10px;
}
.chat-main > .el-card__body {
  padding: 0;
  height: 450px;
}
.chat-body {
  display: flex;
  height: 450px;
}
.chat-list + .chat-panel {
  border-left: 1px solid rgb(235, 238, 245);
}
.chat-panel {
  height: 450px;
  width: calc(100% - 200px);
}
.chat-display + .chat-input {
  border-top: 1px solid rgb(235, 238, 245);
}
.chat-display {
  width: 96%;
  height: 56%;
  padding: 2%;
}
.chat-input {
  width: 100%;
  height: 30%;
}
.chat-input > textarea {
  height: 100%;
  width: 100%;
  padding: 2%;
  border: none;
  resize: none;
}

.chat-bottom {
  display: flex;
  flex-direction: row-reverse;
  padding-right: 30px;
}
</style>
